import http from '@/utils/http'

/**
 * 登录
 * @param {*} url
 * @param {*} data
 * @returns
 */
export const potLoginWxMin = data => {
  return http({
    url: '/login/wxMin',
    data
  })
}

/**
 * 模拟登录
 * @param {*} mobile 手机号
 * @returns
 */
export const loginWxMinSimpleAPI = mobile => {
  return http({
    url: '/login/wxMin/simple',
    method: 'POST',
    data: {
      phoneNumber: mobile
    }
  })
}

/**
 * 获取个人用户信息
 * @returns
 */
export const getMemberProfileAPI = () => {
  return http({
    url: '/member/profile'
  })
}

/**
 * 修改用户头像
 * @param {*} file
 * @returns
 */
export const editMemberProfileAvatarAPI = data => {
  return uni.uploadFile({
    url: '/member/profile/avatar',
    filePath: data,
    name: 'file'
  })
}

export const saveEditUserInfoAPI = data => {
  return http({
    url: '/member/profile',
    method: 'PUT',
    data
  })
}
